<template>
  <svg :class="svgClass" aria-hidden="true">
    <use :xlink:href="iconName"></use>
    <title v-if="!!title">{{title}}</title>
  </svg>
</template>
<script setup lang="ts">
    import { computed } from 'vue';

    const props = defineProps({
      iconClass: {
        type: String,
        required: true
      },
      className: {
        type: String
      },
      title: {
        type: String,
        default: ''
      }
    });

    

    const iconName = computed(() => `#icon-${props.iconClass}`);
    const svgClass = computed(() => {
          if (props.className) {
            return 'designer-svg-icon ' + props.className
          } else {
            return 'designer-svg-icon'
          }
    });
</script>

<style lang="scss" scoped>
  .designer-svg-icon {
    width: 1.1em;
    height: 1.1em;
    margin-left: 0.35em;
    margin-right: 0.35em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
</style>
